<?php
namespace app\api\controller;
use app\common\BaseController;
use app\api\model\Guide as GuideModel;
use app\common\Logs;
class Guide extends BaseController{
    public function __construct(GuideModel $guideModel){
        parent::__construct();
        $this->model = $guideModel;
    }
    public function index(){
        $params = $this->request->get();
        $data = $this->model->allowField(true)->guideList($params);
        return $data;
    }
    //添加
    public function create(){
        $params = $this->request->get();       
        $data = $this->model->allowField(true)->data($params)->save();
        return $data;
    }
    //更新
    public function update(){
        $params = $this->request->get();        
        $data = $this->model->allowField(true)->save($params,['id',$params['id']]);
        return $data;
    }
    //删除
    public function delete(){
        $params = $this->request->get();
        $data = $this->model->allowField(true)->where('id',$params['id'])->delete();
        return $data;
    }
}
